package com.haojiang.mh.remote.utils;

import android.util.Log;

public class LogUtil {

    private static final String TAG = "colin";

    public static int mCurLevel = 1;
    public static final int VERBOSE_LEVEL = 5;
    public static final int DEBUG_LEVEL = 4;
    public static final int INFO_LEVEL = 3;
    public static final int WARNING_LEVEL = 2;
    public static final int ERROR_LEVEL = 1;

    public static void v(Object object, String log) {
        if (mCurLevel >= VERBOSE_LEVEL) {
            Log.v(object.getClass().getSimpleName(), log);
        }
    }

    public static void d(Object object, String log) {
        if (mCurLevel >= DEBUG_LEVEL) {
            Log.d(object.getClass().getSimpleName(), log);
        }
    }

    public static void i(Object object, String log) {
        if (mCurLevel >= INFO_LEVEL) {
            Log.i(object.getClass().getSimpleName(), log);
        }
    }

    public static void w(Object object, String log) {
        if (mCurLevel >= WARNING_LEVEL) {
            Log.w(object.getClass().getSimpleName(), log);
        }
    }

    public static void e(String log) {
        if (mCurLevel >= ERROR_LEVEL) {
            Log.e(TAG, log);
        }
    }

    public static void e(Object object, String log) {
        if (mCurLevel >= ERROR_LEVEL) {
            if (object != null) {
                if (log != null) {
//                    Log.e(object.getClass().getSimpleName(), log);
                    Log.e(TAG, log);
                } else {
//                    Log.e(object.getClass().getSimpleName(), "null");
                    Log.e(TAG, "null");
                }
            } else {
                if (log != null) {
                    Log.e(TAG, log);
                } else {
                    Log.e(TAG, "null");
                }
            }
        }
    }
}
